Return to doc.sitecore.com

Valid for Sitecore All Releases
RSS Module Documentation

 

1.  Introduction - Content Syndication

You may skip this section if you’re already familiar with the RSS.

RSS (Really Simple Syndication) is the most popular way to syndicate your content. What is content syndication after all? Imagine a complex site that updates on the regular basis – we can consider SDN5 as an example. It contains a large number of sections like the End User Documentation, Developer Articles, Downloads, etc., and it is updated on daily basis.

Frequent updates are good, but also make it quite hard for the user to keep up to date with the new content. The ‘news’ section helps, but still requires the user to browse the site every day and scroll through all of the updates. Of course, this is only good if the ad revenues are your main source of income, but not that good in terms of user satisfaction and convenience.

Syndication is an elegant solution to this problem: you can define any number of RSS feeds that will syndicate the entire site or any portion of it. Then a user may choose to subscribe to the feed of one’s interest (one may only be interested in new downloads or new articles on xaml technology) and have all of the updates delivered to one’s PC automatically. It is really simple and convenient!

And since the Sitecore manages and delivers your content, it is logical to allow Sitecore syndicate it and provide RSS feeds for external users.

Further reading:

2.  Installation Instructions

To install Sitecore RSS Module you have to install a package, modify the web.config file and perform a full publish.

2.1.  Installing the Package

Please refer to ' Installing Modules and Packages' article on general package installation instructions. The package will add ‘RSS Feeds’ folder with an example feed to /sitecore/content and ‘RSS Module’ folder with a number of templates to your templates folder.

RSS Module image

2.2.  Modifying the web.config file

When you have installed the package, you need to modify the web.config file to enable non-regular feeds:

To enable embedded feeds:

Add the RSS processor to the HttpRequestBegin pipeline:
It is important to add the processor in the right place - after the LayoutResolver and before ExecuteRequest.

 

<httpRequestBegin> 
 ... 
 <processor type="Sitecore.Pipelines.HttpRequest.LayoutResolver, Sitecore.Kernel"/> 
 <processor type="Sitecore.Modules.RSS.HttpRequest, Sitecore.Modules.RSS"/> 
 <processor type="Sitecore.Pipelines.HttpRequest.ExecuteRequest, Sitecore.Kernel"/> 
 ...
</httpRequestBegin>

To enable static feeds:
Add the following ‘publish:end’ event handler:
<event name="publish:end">
  ...
  <handler type="Sitecore.Modules.RSS.PublishingHandler, Sitecore.Modules.RSS" method="OnPublishEnd"/>
  ...
</event>

2.3.  Perform the Full Publishing

It is recommended to perform the full publishing after module installation.  

Note (valid for Sitecore 5.3.0): If something doesn’t work, make sure that the /sitecore/system/Modules/RSS/Global settings node is published to the WEB database during the Full publishing.

2.4.  Upgrade Instructions

Upgrading from Rss module v1.0.0 to v1.1.0

Just install the package over the existing one.

3.  Using Sitecore RSS Module

This section covers the main features of the Sitecore RSS Module. The module allows you to syndicate your content in three different ways by using regular, static and embedded feeds.

3.1.  Regular Feeds

This is the most straight-forward way to syndicate your content: create a new feed item in Sitecore client, point it to the site section you want to syndicate and provide your users with a link to this item, so they can subscribe to it. Regular feeds don’t require any changes to the web.config file.
RSS Module installs one sample feed and we will use it as an example: Navigate to the /RSS Feeds/Example feed item and open the Syndication Feed section:
 

What matters at the moment, is that ‘Syndication root’ property is set to /sitecore/content/home. If you have a clean installation and your home node is empty - add a couple of items to it for demonstration purposes:

Publish the items (remember that workflow can prevent items from being published). Then open a web browser and access the Example feed from the front end: http://localhost/RSS Feeds/Example feed.html

You should see the xml content similar to this:

1 <?xml version="1.0" encoding="utf-8"?>
2 <rss version="2.0">
3   <channel>
4     <title>Example feed</title>
5     <description>Using this feed to test the Sitecore RSS Module</description>
6     <link>http://localhost/RSS Feeds/Example feed.html</link>
7     <pubDate>Wed, 21 Sep 2005 11:23:05 GMT</pubDate>
8     <lastBuildDate>Wed, 21 Sep 2005 10:57:37 GMT</lastBuildDate>
9     <language>en</language>
10     <copyright>Copyright</copyright>
11     <generator>Sitecore CMS: http://www.sitecore.net. Sitecore RSS module: Sitecore.Modules.RSS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</generator>
12     <item>
13       <title>FAQ</title>
14       <description>Frequently Asked Question</description>
15       <link>http://localhost/Home/FAQ.html</link>
16       <pubDate>Wed, 21 Sep 2005 10:57:37 GMT</pubDate>
17       <author>Admin</author>
18       <guid>be77becf-2c0e-4ce7-87e0-022aa9bc305f</guid>
19     </item>
20     <item>
21       <title>article</title>
22       <description>A brand new article under home</description>
23       <link>http://localhost/Home/Article.html</link>
24       <pubDate>Wed, 21 Sep 2005 10:57:08 GMT</pubDate>
25       <author>Admin</author>
26       <guid>53d8f6c6-39b0-4c21-a73a-65ee9b963e75</guid>
27     </item>
28   </channel>
29 </rss>

This is the actual RSS feed: it provides information in a specific flavor of xml that RSS aggregators re able to understand. To demonstrate this I will use RSS Bandit, but you can use any desktop or web (such as Bloglines) aggregator you like. They all will be able to understand your feed and there are plenty of free ones.


Of course, feeds are not usually used to syndicate your entire site: they are only used to show a number of most recent items in the given section. To define that properties you should use other sections of the feed item. We will study them below.
Please note that some additional options might be added as module develops. Please use the help facilities provided by the Sitecore client to get help on any of the fields.

3.2.  Syndication Info Section

Syndication Info section provides information on the whole feed, such as its title, description, link and copyright. ‘Write author’ option is used to indicate whether each feed item should contain information about the item creator.
Link is used to allow user to go back to your site to get more information. It defaults to the syndicated item itself, so if the feed points to the ‘Home’ item, it will automatically generate external link similar to http://www.yoursite.com/home.html. Leave the ‘Link’ field empty to allow the default behavior.

3.3.  Syndication Settings Section

Use the ‘Maximum age’ and ‘Maximum item count’ fields to define what items should be included in the feed. Maximum age prevents items that are older than that to be included, and Maximum item count leaves no more than this number of the latest items in the feed.

Turn on the ‘Include Updates’ setting to also notify user when the item had been updated. When the option is off, the item will get to the feed only once, when it is created. Later it will be pushed out by other newly created items and never appear again. However, if the option is on, item will return to the top of the feed each time someone updates the item.

In other words, the 'update date will be used instead of the creation date when sorting the items by date.

3.4.  Syndication Fields Section

Syndication Fields section is used to determine which fields of the syndicated items should be included in the feed. When the feed will be iterating through the content of items to populate itself, it will try to access the ‘Title’ field of each item to retrieve the title information.

According to the RSS 2.0 Specification, either Title or the Description must be present.

3.5.  Syndication Filters Section

You can use the syndication filters section to prevent certain items from being included in the feed (‘Exclude template’ setting) or to include items based on certain template only (‘Only include template’ setting).

3.6.  Static Feeds

Static feeds slightly differ from the regular feeds. While the regular feeds are emitted at run time when user’s RSS aggregator accesses the feed .html page, static feeds are stored as xml files on disk and users link to the physical files rather than .html pages.

To enable this behavior you should fill the ‘Feed Xml File’ setting in the ‘Syndication Feed’ section. Please note that this field is multilanguaged as you might want to provide different feeds for different languages.

By default the feed will be stored in the /data folder of your solution.
Static feeds provide much better performance than other kinds of feeds simply because they are generated only once on each publish and they are served directly by your web server, bypassing the asp.net and Sitecore frameworks.

However since they’re generated before the actual web request comes in, they involve the following tradeoff: it is impossible to generate the full link to the item (including the host name) on the publishing stage, because the same item can be served by different sites. To overcome this you need to specify links explicitly. This behavior might be reconsidered in the subsequent versions.

Note: Even though the module package installs the ‘RSS Feeds’ folder, you can choose to store your feeds anywhere you like, either inside or outside of the main content tree. Static feeds depend on the Link database to find all feeds in the database, so please rebuild the link database  if the feed doesn’t get rebuilt on publish.

3.7.  Embedded Feeds

Embedded feeds are another flavor of regular RSS feeds: they don’t require the actual feed item to work, as they are embedded into the content items. We will return to our example and add a couple of articles under the article node.

Now we still have one feed that syndicates the entire /home tree, but what if the user is only interested in new articles? We could create ‘Articles’ feed in addition to the example feed (and we actually have to do this if we want to use the static feeds), but there’s another option: using the embedded feeds.

Embedded feeds depend on the RSS device installed by the package. If the incoming request matches the RSS device, the RSS feed will be served instead of the actual item contents.

By default the RSS device looks for the ‘rss’ querystring key to be activated. So, taking that into consideration, user can subscribe to the “http://localhost/Article.html?rss=” feed and receive syndicated updates of the articles section only.

You can add a simple rendering to your layout that will generate the embedded feed link for each item.
The disadvantage of the embedded feeds is that you cannot specify the feed settings, because your content items don’t have the corresponding fields. By default the global settings will be used for the embedded feeds, but another option is to inherit your custom template from the ‘Rss Settings Base’ template located in the /templates/RSS module folder. Then your items will inherit all the required fields.

Note: You can disable embedded feeds for any item using the ‘Allow embedded feeds’ setting.

4.  Advanced Features

The chapter guides you through the advanced features of the RSS module.

4.1.  Feed Composition

You can nest feed items to create hierarchical feed structures. In this way the parent feed will have all items that child feeds have plus its own items. For example:

We have two separate sites apart from the main content tree, and we want to syndicate them as well. We add two RSS feeds under the ‘Example feed’ node, one for each site and set their ‘Syndication root’ properties respectively.

Now the ‘first site feed’ and the ‘second site feed’ will act as the single feed does, containing only the items from their parts of the solution. But the contents of the ‘Example feed’ will change: it will not only syndicate the /home tree (because its syndicate root property is set to /home) but also the /First site and the /Second site trees.

There’s another advantage in using the feed composition: child feeds inherit most of the settings from its parent.

4.2.  Settings Inheritance

Consider the same content setup as in the previous section. We have added two child feeds to the ‘Example feed’. Now let’s take the ‘Maximum item count’ property as an example:

We’ve explicitly set it to ‘10’ in the ‘Example feed’ before, but we haven’t set it in the child feeds. In this case the child feeds, seeing that the setting is not supplied directly for them will try to retrieve this setting from their parent.

So while we left the ‘maximum item count’ setting empty in ‘First site feed’, the effective setting will still be ‘10’, because of the parent feed.

But what if the parent of the item is not a feed or the parent’s setting is also empty? Global settings shall apply.

4.3.  Global Settings

In the situation when feed item doesn’t have the required setting set explicitly, the global settings are used instead. Global settings can be accessed using the Sitecore start menu: Sitecore » All Applications » RSS Module » Global settings.

Global settings contain the same set of settings as the rest of the RSS feeds, however they all are set explicitly, so that any item can fall back to the global settings when needed.